package com.yin.myproject.hadoop.kpi.broswer;

import com.yin.myproject.hadoop.BaseDriver;
import com.yin.myproject.hadoop.JobInitModel;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;

import java.io.IOException;

/**
 * @author Eason
 * @create 2018-03-26 10:15
 **/
public class KpiBrowser {
    public final static String nameNodeUri="hdfs://172.16.20.123:9000";

    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
        System.setProperty("HADOOP_USER_NAME", "root");
        System.setProperty("hadoop.home.dir", "/opt/hadoop-2.7.3");

        String[] inPath = new String[]{"/data/1-kpi/*"};
        String outPath = "/out/1-kpi/browser";
        Configuration conf = new Configuration();
        String jobName = "browser-pv";
        JobInitModel job = new JobInitModel(inPath, outPath, conf, null, jobName
                , KpiBrowser.class, null, Mapper.class, Text.class, IntWritable.class, null, null, Reducer.class
                , Text.class, IntWritable.class);

//        JobInitModel sortJob = new JobInitModel(new String[]{outPath + "/part-*"}, outPath + "/sort", conf, null
//                , jobName + "sort", KpiBrowser.class, null, Mapper.class, Text.class, IntWritable.class, null, null, null, null, null);

        BaseDriver.initJob(new JobInitModel[]{job});
    }
}
